<script src="../../main.js">
</script>
<template>
  <div>
    <el-form v-if="cart=='list_card'">
      <div class="items" :class="className">
        <div v-for="(item,index) in da" :key="index" class="bg_con">
          <el-form-item label="上传图片" :label-width="formLabelWidth">
            <el-col :span="12">
              <div @click="sel_index = index">
                <uploadpic
                  v-if="className=='banner'"
                  :piclink="item.piclink"
                  :index="index"
                  :width="350"
                  :height="180"
                  :real_width="700"
                  :real_height="360"
                  :is_more="false"
                  @send_pic="upload_pic"
                ></uploadpic>
                <uploadpic
                  v-else
                  :piclink="item.piclink"
                  :index="index"
                  :is_tip="false"
                  :width="200"
                  :is_more="false"
                  @send_pic="upload_pic"
                ></uploadpic>
              </div>
            </el-col>
          </el-form-item>
          <el-form-item label="排序" :label-width="formLabelWidth">
            <el-col :span="12">
              <el-input v-model="item.sort"></el-input>
            </el-col>
          </el-form-item>
          <el-form-item label="链接到" :label-width="formLabelWidth">
            <el-col :span="12">
              <el-input :disabled="item.disable" v-model="item.links" class="mar-input"></el-input>
              <el-input :disabled="item.disable" v-model="item.desc"></el-input>
            </el-col>
            <el-col :span="8" class="mar_lf_15">
              <LinkMenu :index="index" @sendRow="getSendRow"></LinkMenu>
            </el-col>
          </el-form-item>
          <!--                    <el-form-item label="标题" :label-width="formLabelWidth">-->
          <!--                        <el-col :span="12">-->
          <!--                            <el-input v-model.number="item.title"></el-input>-->
          <!--                        </el-col>-->
          <!--                    </el-form-item>-->

          <div class="dele_banner">
            <!-- <a
              href="javascript:;"
              @click.prevent="pre_img_btn('left',item,index)"
              class="alert-delete "
              title="向前"
            >
              <i class="el-icon-caret-left"></i>
            </a>

            <a
              href="javascript:;"
              @click.prevent="pre_img_btn('right',item,index)"
              class="alert-delete "
              title="向后"
            >
              <i class="el-icon-caret-right"></i>
            </a>-->

            <a
              href="javascript:;"
              @click.prevent="delData(index,item.id)"
              class="alert-delete"
              title="隐藏"
            >
              <i class="el-icon-close"></i>
            </a>
          </div>
        </div>
      </div>
      <div
        class="bg_con add_banner"
        @click.prevent="da.push({piclink:'',links:'',title:'',id:0,disable:true,desc:''})"
      >
        <i class="el-icon-plus"></i>
      </div>
    </el-form>

    <el-row v-if="cart=='list'" class="items" :class="className">
      <el-col :span="5" class="tr">
        <div
          class="index_img_nav img_nav addImg_menu"
          @click.prevent="showDio"
          style="margin:0 auto"
        >
          <i class="el-icon-plus"></i>
        </div>
      </el-col>
      <el-col
        :span="5"
        class="tr shops_list"
        v-for="(item,index) in da"
        :key="index"
        style="margin-bottom:5px"
      >
        <div class="index_img_nav img_nav" style="margin:0 auto">
          <img :src="$fnc.getImgUrl(item.piclink)" alt />
        </div>

        <div class="sel_img_btn sel_img_btn-shop" style="height:auto">
          <el-input v-model.number="item.index" type="number" @blur="getBlur($event,item.index)"></el-input>
          <!-- <el-input-number :value="index"   ></el-input-number> -->

          <!-- <div class="sel_img_left" @click="pre_img_btn('left',item,index)">
            <i class="el-icon-caret-left"></i>
          </div>
          <div class="sel_img_right" @click="pre_img_btn('right',item,index)">
            <i class="el-icon-caret-right"></i>
          </div>-->
        </div>
        <a
          href="javascript:;"
          @click.prevent="delData(index,item.id)"
          class="alert-delete dele_banner"
          title="隐藏"
        >
          <i class="el-icon-close"></i>
        </a>
      </el-col>
    </el-row>

    <div>
      <div v-if="cart=='list_menu'" class="items" :class="className">
        <div v-for="(menu_item,i) in da" :key="i">
          <div class="bg_con">
            <el-row>
              <el-col :span="6">
                <!-- <div class="index_img_nav img_nav"
                                    style="margin:0 auto">
                                    <img :src="$fnc.getImgUrl(menu_item.piclink)"
                                        class="nav_view_pic"
                                        alt="" />
                                    <span class="imgnav-reselect">
                                        <my-upload url="/api/common/upload/index/"
                                            :onload="befau"
                                            :index="i"
                                            :maxWidth='50'
                                            :on-success="uploadSuccess" />
                                    </span>
                </div>-->
                <div @click="sel_index = i">
                  <uploadpic
                    :piclink="menu_item.piclink"
                    :width="120"
                    :height="120"
                    :real_width="80"
                    :real_height="80"
                    :is_more="false"
                    @send_pic="upload_pic"
                  ></uploadpic>
                </div>
              </el-col>
              <el-col :span="18">
                <el-form-item label="标题名称" label-width="80px">
                  <el-col :span="12">
                    <el-input v-model="menu_item.title"></el-input>
                  </el-col>
                </el-form-item>
                <el-form-item label="排序" v-if="is_index == true" label-width="80px">
                  <el-col :span="12">
                    <el-input v-model="menu_item.sort"></el-input>
                  </el-col>
                </el-form-item>
                <el-form-item label="链接到" label-width="80px">
                  <el-col :span="12">
                    <el-input
                      :disabled="menu_item.disable"
                      v-model="menu_item.links"
                      class="mar-input"
                    ></el-input>
                    <el-input :disabled="menu_item.disable" v-model="menu_item.desc"></el-input>
                  </el-col>
                  <el-col :span="8" class="mar_lf_15">
                    <LinkMenu :index="i" @sendRow="getSendRow"></LinkMenu>
                  </el-col>
                </el-form-item>
                <a
                  href="javascript:;"
                  @click.prevent="delData(i,menu_item.id)"
                  class="alert-delete dele_banner"
                  title="隐藏"
                >
                  <i class="el-icon-close"></i>
                </a>
              </el-col>
            </el-row>
          </div>
        </div>
        <el-row>
          <el-col :span="6" class="tr">
            <div
              class="index_img_nav img_nav addImg_menu"
              @click.prevent="da.push({piclink:require('../../assets/img/config/icon01.png'),links:'',title:'菜单名',id:0,disable:true})"
              style="margin:0 auto"
            >
              <i class="el-icon-plus"></i>
            </div>
          </el-col>
        </el-row>
      </div>
    </div>

    <div>
      <div v-if="cart=='list_merchant'" class="items" :class="className">
        <div v-for="(item,i) in da" :key="i">
          <div class="bg_con">
            <el-row>
              <el-col :span="6" class="tr">
                <div class="index_img_nav img_nav" style="margin:0 auto;">
                  <img :src="$fnc.getImgUrl(item.shop_logo+'' )" alt style="width:100%" />
                </div>
              </el-col>
              <el-col :span="18">
                <el-form-item label="商户名称">
                  <el-col :span="12">
                    <p style="text-align:left">{{item.shop_title}}</p>
                  </el-col>
                </el-form-item>
                <el-form-item label="商户地址">
                  <el-col :span="12">
                    <p
                      style="  text-align: left"
                    >{{$fnc.deleteNumber(item.shop_province+item.shop_area)}}</p>
                  </el-col>
                </el-form-item>
                <a
                  href="javascript:;"
                  @click.prevent="del_mer_Data(i,item.id)"
                  class="alert-delete dele_banner"
                  title="隐藏"
                >
                  <i class="el-icon-close"></i>
                </a>
              </el-col>
            </el-row>
          </div>
        </div>
        <el-row>
          <el-col :span="6" class="tr">
            <div
              class="index_img_nav img_nav addImg_menu"
              @click.prevent="add_mer_data"
              style="margin:0 auto"
            >
              <i class="el-icon-plus"></i>
            </div>
          </el-col>
        </el-row>
      </div>
    </div>

    <div>
      <div v-if="cart=='list_footer'" class="items" :class="className">
        <div v-for="(menu_item,i) in da" :key="i">
          <div>
            <el-row>
              <el-col :span="6" class="tr">
                <div class="index_img_nav img_nav" style="margin:0 auto;">
                  <van-icon :name="menu_item.piclink" style="font-size: 90px"></van-icon>
                  <span class="imgnav-reselect">
                    <my-upload
                      url="/api/common/upload/index/"
                      :onload="befau"
                      :index="i"
                      :on-success="uploadSuccess"
                    />
                  </span>
                </div>
              </el-col>
              <el-col :span="18">
                <el-form-item label="图标选择" label-width="80px">
                  <el-col :span="12">
                    <el-select v-model="menu_item.piclink" placeholder="请选择">
                      <el-option
                        v-for="item in icon"
                        :key="item.value"
                        :label="item.label"
                        :value="item.value"
                      >
                        <span style="float: left">{{ item.label }}</span>
                        <span style="float: right; color: #8492a6; font-size: 13px">
                          <van-icon :name="item.value"></van-icon>
                        </span>
                      </el-option>
                    </el-select>
                  </el-col>
                </el-form-item>
                <el-form-item label="标题名称" label-width="80px">
                  <el-col :span="12">
                    <el-input v-model="menu_item.title"></el-input>
                  </el-col>
                </el-form-item>
                <el-form-item label="排序" v-if="is_index == true" label-width="80px">
                  <el-col :span="12">
                    <el-input v-model="menu_item.sort"></el-input>
                  </el-col>
                </el-form-item>
                <el-form-item label="链接到" label-width="80px">
                  <el-col :span="12">
                    <el-input
                      :disabled="(menu_item.disable || i == 0) ? true :false"
                      v-model="menu_item.links"
                      class="mar-input"
                    ></el-input>
                    <el-input
                      :disabled="(menu_item.disable || i == 0) ? true :false"
                      v-model="menu_item.desc"
                    ></el-input>
                  </el-col>
                  <el-col :span="8" class="mar_lf_15">
                    <LinkMenu :index="i" @sendRow="getSendRow"></LinkMenu>
                  </el-col>
                </el-form-item>
                <a
                  href="javascript:;"
                  @click.prevent="delData(i,menu_item.id)"
                  class="alert-delete dele_banner"
                  title="隐藏"
                >
                  <i class="el-icon-close"></i>
                </a>
              </el-col>
            </el-row>
          </div>
        </div>
        <el-row>
          <el-col :span="6" class="tr">
            <div
              class="index_img_nav img_nav addImg_menu"
              @click.prevent="da.push({piclink:'',links:'',title:'',id:0,disable:true})"
              style="margin:0 auto"
            >
              <i class="el-icon-plus"></i>
            </div>
          </el-col>
        </el-row>
      </div>
    </div>

    <div>
      <div v-if="cart=='headerList'" class="items" :class="className">
        <div v-for="(menu_item,i) in da" :key="i">
          <div>
            <el-row>
              <p
                style="text-align: left;padding-left: 25px;padding-bottom: 23px;font-size: 14px;color: #606266;"
              >{{i%2 == 0 ? '左侧图标':'右侧图标'}}：</p>
              <el-col :span="6" class="tr">
                <div class="index_img_nav img_nav" style="margin:0 auto;">
                  <van-icon :name="menu_item.piclink" style="font-size: 90px"></van-icon>
                  <span class="imgnav-reselect">
                    <my-upload
                      url="/api/common/upload/index/"
                      :onload="befau"
                      :index="i"
                      :on-success="uploadSuccess"
                    />
                  </span>
                </div>
              </el-col>
              <el-col :span="18">
                <el-form-item label="图标选择" label-width="80px">
                  <el-col :span="12">
                    <el-select v-model="menu_item.piclink" placeholder="请选择">
                      <el-option
                        v-for="item in icon"
                        :key="item.value"
                        :label="item.label"
                        :value="item.value"
                      >
                        <span style="float: left">{{ item.label }}</span>
                        <span style="float: right; color: #8492a6; font-size: 13px">
                          <van-icon :name="item.value"></van-icon>
                        </span>
                      </el-option>
                    </el-select>
                  </el-col>
                </el-form-item>
                <el-form-item label="标题名称" label-width="80px">
                  <el-col :span="12">
                    <el-input v-model="menu_item.title"></el-input>
                  </el-col>
                </el-form-item>
                <el-form-item label="链接到" label-width="80px">
                  <el-col :span="12">
                    <el-input v-model="menu_item.links" class="mar-input"></el-input>
                    <el-input v-model="menu_item.desc"></el-input>
                  </el-col>
                  <el-col :span="8" class="mar_lf_15">
                    <LinkMenu :index="i" @sendRow="getSendRow"></LinkMenu>
                  </el-col>
                </el-form-item>
              </el-col>
            </el-row>
          </div>
        </div>
      </div>
    </div>
    <!-- 内容付费 -->
    <div>
      <div v-if="cart=='list_lesson'" class="items" :class="className">
        <div v-for="(lesson_item,index) in da" :key="index">
          <div class="bg_con">
            <div class="lesson_article_item">
              <div class="lesson_article_img">
                <img :src="$fnc.getImgUrl(lesson_item.piclink)" alt />
              </div>
              <div class="lesson_article_content">
                <p>{{lesson_item.title}}</p>
                <p>
                  {{$fnc.toFixedZ(lesson_item.price)}}
                  <span>{{lesson_item.hit}}人最近报名</span>
                </p>
              </div>
              <a
                href="javascript:;"
                @click.prevent="delData(index,lesson_item.id)"
                class="alert-delete dele_banner"
                title="隐藏"
              >
                <i class="el-icon-close"></i>
              </a>
              <div class="lesson_article_sort">
                <i class="el-icon-caret-top" @click="pre_img_btn('left',lesson_item,index)"></i>
                <i class="el-icon-caret-bottom" @click="pre_img_btn('right',lesson_item,index)"></i>
              </div>
            </div>
          </div>
        </div>
        <el-row>
          <el-col :span="6" class="tr">
            <div
              class="index_img_nav img_nav addImg_menu"
              @click.prevent="open_lesson"
              style="margin:0 auto"
            >
              <i class="el-icon-plus"></i>
            </div>
          </el-col>
        </el-row>
      </div>
    </div>
    <!-- 房产 -->
    <div>
      <div v-if="cart=='estate'" class="items" :class="className">
        <div v-for="(item,index) in da" :key="index">
          <div class="bg_con">
            <div class="lesson_article_item estate-item">
              <div class="home_item">
                <div class="home_item_left">
                  <el-image style="width: 104px; height: 94px" :src="item.piclink"></el-image>
                </div>
                <div class="home_item_right">
                  <p>{{item.title}}</p>
                  <p>
                    {{item.sales_office}}
                    <span v-if="item.construction_area">
                      建面
                      {{item.construction_area}}m²
                    </span>
                  </p>
                  <p>
                    <span>{{item.min_price}}</span>万元起
                  </p>
                  <p>
                    <span v-for="(it,i) in toChatStr(item.sub_title)" :key="i">{{it}}</span>
                  </p>
                </div>
              </div>
              <a
                href="javascript:;"
                @click.prevent="delData(index,item.id)"
                class="alert-delete dele_banner"
                title="隐藏"
              >
                <i class="el-icon-close"></i>
              </a>
              <div class="lesson_article_sort">
                <i class="el-icon-caret-top" @click="pre_img_btn('left',lesson_item,index)"></i>
                <i class="el-icon-caret-bottom" @click="pre_img_btn('right',lesson_item,index)"></i>
              </div>
            </div>
          </div>
        </div>
        <el-row>
          <el-col :span="6" class="tr">
            <div
              class="index_img_nav img_nav addImg_menu"
              @click.prevent="open_estate"
              style="margin:0 auto"
            >
              <i class="el-icon-plus"></i>
            </div>
          </el-col>
        </el-row>
      </div>
    </div>
    <!-- 新闻 -->
    <div>
      <div v-if="cart=='news'" class="items" :class="className">
        <div v-for="(item,index) in da" :key="index">
          <div class="bg_con estate-news-box">
            <div class="lesson_article_item estate-news-item">
              <div class="lesson_article_img" v-if="item.piclink">
                <img :src="$fnc.getImgUrl(item.piclink)" alt />
              </div>
              <div class="lesson_article_content">
                <p>{{item.title}}</p>
                <p>新闻头条</p>
              </div>
              <a
                href="javascript:;"
                @click.prevent="delData(index,item.id)"
                class="alert-delete dele_banner"
                title="隐藏"
              >
                <i class="el-icon-close"></i>
              </a>
              <div class="lesson_article_sort">
                <i class="el-icon-caret-top" @click="pre_img_btn('left',item,index)"></i>
                <i class="el-icon-caret-bottom" @click="pre_img_btn('right',item,index)"></i>
              </div>
            </div>
          </div>
        </div>
        <el-row>
          <el-col :span="6" class="tr">
            <div
              class="index_img_nav img_nav addImg_menu"
              @click.prevent="open_news"
              style="margin:0 auto"
            >
              <i class="el-icon-plus"></i>
            </div>
          </el-col>
        </el-row>
      </div>
    </div>
    <!-- 拼购 -->
    <div>
      <div v-if="cart=='group_buy'" class="items" :class="className">
        <div v-for="(product_item,index) in da" :key="index">
          <div class="bg_con">
            <div class="lesson_article_item">
              <div class="lesson_article_img">
                <img :src="$fnc.getImgUrl(product_item.piclink)" alt />
              </div>
              <div class="lesson_article_content">
                <p>{{product_item.title}}</p>
              </div>
              <a
                href="javascript:;"
                @click.prevent="delData(index,product_item.id)"
                class="alert-delete dele_banner"
                title="隐藏"
              >
                <i class="el-icon-close"></i>
              </a>
              <div class="lesson_article_sort">
                <i class="el-icon-caret-top" @click="pre_img_btn('left',product_item,index)"></i>
                <i class="el-icon-caret-bottom" @click="pre_img_btn('right',product_item,index)"></i>
              </div>
            </div>
          </div>
        </div>
        <el-row>
          <el-col :span="6" class="tr">
            <div
              class="index_img_nav img_nav addImg_menu"
              @click.prevent="open_groupbuy"
              style="margin:0 auto"
            >
              <i class="el-icon-plus"></i>
            </div>
          </el-col>
        </el-row>
      </div>
    </div>

    <xzShop :show="show" @sendShop="getSend" :isAddIden="true" @isshow="getShow"></xzShop>

    <xzlesson :show="lesson_show" @sendShop="getSend" @isshow="lesson_show = false;"></xzlesson>

    <xzusershop
      :show="shop_show"
      v-if="shop_show"
      :isAll="true"
      :add_types="true"
      showType="list"
      @sendShop="getSend_id"
      @isshow="getShow"
    ></xzusershop>

    <xzNews :show="news_show" v-if="news_show" @sendShop="getSend" @isshow="news_show = false;"></xzNews>

    <xzEstate :show="estate_show" @sendShop="getSend" @isshow="estate_show = false"></xzEstate>

    <xzgroupbuy :show="groupbuy_show" @sendShop="getSend" @isshow="groupbuy_show = false;"></xzgroupbuy>
  </div>
</template>
<script>
import myUpload from "@/components/currency/MyUpload.vue";
import Sortable from "sortablejs";
import LinkMenu from "@/components/currency/Link_menu.vue";
import xzShop from "@/components/currency/xz_shop.vue";
import xzusershop from "@/components/currency/xz_usershop.vue";
import xzlesson from "@/components/currency/xz_lesson.vue";
import uploadpic from "@/components/page/pic/up_pic";
import xzNews from "@/components/currency/xz_news.vue";
import xzEstate from "@/components/currency/xz_estate.vue";
import xzgroupbuy from "@/components/currency/xz_groupbuy.vue";
export default {
  name: "upcard",
  props: {
    data: {
      type: Array,
      default: []
    },
    cart: null,
    className: null,
    is_index: {
      type: Boolean,
      default: false
    }
  },

  data() {
    return {
      groupbuy_show:false,
      news_show: false,
      estate_show: false,
      sel_index: null,
      lesson_show: false,
      activeIndex: 0,
      current: "xzusershop",
      shop_show: false,
      reward_option: this.$store.state.rewardOption, //奖励类型
      icon: [
        { label: "like-o", value: "like-o" },
        { label: "star-o", value: "star-o" },
        { label: "phone-o", value: "phone-o" },
        { label: "setting-o", value: "setting-o" },
        { label: "fire-o", value: "fire-o" },
        { label: "coupon-o", value: "coupon-o" },
        { label: "cart-o", value: "cart-o" },
        { label: "shopping-cart-o", value: "shopping-cart-o" },
        { label: "cart-circle-o", value: "cart-circle-o" },
        { label: "friends-o", value: "friends-o" },
        { label: "comment-o", value: "comment-o" },
        { label: "gem-o", value: "gem-o" },
        { label: "gift-o", value: "gift-o" },
        { label: "point-gift-o", value: "point-gift-o" },
        { label: "send-gift-o", value: "send-gift-o" },
        { label: "service-o", value: "service-o" },
        { label: "bag-o", value: "bag-o" },
        { label: "todo-list-o", value: "todo-list-o" },
        { label: "balance-list-o", value: "balance-list-o" },
        { label: "medel-o", value: "medel-o" },
        { label: "close", value: "close" },
        { label: "clock-o", value: "clock-o" },
        { label: "question-o", value: "question-o" },
        { label: "passed", value: "passed" },
        { label: "add-o", value: "add-o" },
        { label: "gold-coin-o", value: "gold-coin-o" },
        { label: "info-o", value: "info-o" },
        { label: "manager-o", value: "manager-o" },
        { label: "label-o", value: "label-o" },
        { label: "hot-o", value: "hot-o" },
        { label: "hot-sale-o", value: "hot-sale-o" },
        { label: "new-o", value: "new-o" },
        { label: "new-arrival-o", value: "new-arrival-o" },
        { label: "goods-collect-o", value: "goods-collect-o" },
        { label: "eye-o", value: "eye-o" },
        { label: "browsing-history-o", value: "browsing-history-o" },
        { label: "bookmark-o", value: "bookmark-o" },
        { label: "bill-o", value: "bill-o" },
        { label: "video-o", value: "video-o" },
        { label: "shop-o", value: "shop-o" },
        { label: "shop-collect-o", value: "shop-collect-o" },
        { label: "chat-o", value: "chat-o" },
        { label: "smile-comment-o", value: "smile-comment-o" },
        { label: "vip-card-o", value: "vip-card-o" },
        { label: "award-o", value: "award-o" },
        { label: "diamond-o", value: "diamond-o" },
        { label: "volume-o", value: "volume-o" },
        { label: "cluster-o", value: "cluster-o" },
        { label: "underway-o", value: "underway-o" },
        { label: "photo-o", value: "photo-o" },
        { label: "gift-card-o", value: "gift-card-o" },
        { label: "more-o", value: "more-o" },
        { label: "expand-o", value: "expand-o" },
        { label: "play-circle-o", value: "play-circle-o" },
        { label: "pause-circle-o", value: "pause-circle-o" },
        { label: "stop-circle-o", value: "stop-circle-o" },
        { label: "warning-o", value: "warning-o" },
        { label: "phone-circle-o", value: "phone-circle-o" },
        { label: "smile-o", value: "smile-o" },
        { label: "music-o", value: "music-o" },
        { label: "balance-o", value: "balance-o" },
        { label: "refund-o", value: "refund-o" },
        { label: "birthday-cake-o", value: "birthday-cake-o" },
        { label: "user-o", value: "user-o" },
        { label: "thumb-circle-o", value: "thumb-circle-o" },
        { label: "orders-o", value: "orders-o" },
        { label: "tv-o", value: "tv-o" },
        { label: "envelop-o", value: "envelop-o" },
        { label: "flag-o", value: "flag-o" },
        { label: "flower-o", value: "flower-o" },
        { label: "filter-o", value: "filter-o" },
        { label: "bar-chart-o", value: "bar-chart-o" },
        { label: "chart-trending-o", value: "chart-trending-o" },
        { label: "comment-circle-o", value: "comment-circle-o" },
        { label: "brush-o", value: "brush-o" },
        { label: "bullhorn-o", value: "bullhorn-o" },
        { label: "hotel-o", value: "hotel-o" },
        { label: "cashier-o", value: "cashier-o" },
        { label: "newspaper-o", value: "newspaper-o" },
        { label: "warn-o", value: "warn-o" },
        { label: "notes-o", value: "notes-o" },
        { label: "calender-o", value: "calender-o" },
        { label: "bulb-o", value: "bulb-o" },
        { label: "user-circle-o", value: "user-circle-o" },
        { label: "desktop-o", value: "desktop-o" },
        { label: "apps-o", value: "apps-o" },
        { label: "home-o", value: "home-o" },
        { label: "share", value: "share" },
        { label: "search", value: "search" },
        { label: "points", value: "points" },
        { label: "edit", value: "edit" },
        { label: "delete", value: "delete" },
        { label: "qr", value: "qr" },
        { label: "qr-invalid", value: "qr-invalid" },
        { label: "closed-eye", value: "closed-eye" },
        { label: "wap-home", value: "wap-home" },
        { label: "scan", value: "scan" },
        { label: "free-postage", value: "free-postage" },
        { label: "certificate", value: "certificate" },
        { label: "logistics", value: "logistics" },
        { label: "contact", value: "contact" },
        { label: "cash-back-record", value: "cash-back-record" },
        { label: "after-sale", value: "after-sale" },
        { label: "exchange", value: "exchange" },
        { label: "upgrade", value: "upgrade" },
        { label: "ellipsis", value: "ellipsis" },
        { label: "circle", value: "circle" },
        { label: "description", value: "description" },
        { label: "records", value: "records" },
        { label: "sign", value: "sign" },
        { label: "completed", value: "completed" },
        { label: "failure", value: "failure" },
        { label: "ecard-pay", value: "ecard-pay" },
        { label: "peer-pay", value: "peer-pay" },
        { label: "balance-pay", value: "balance-pay" },
        { label: "credit-pay", value: "credit-pay" },
        { label: "debit-pay", value: "debit-pay" },
        { label: "cash-on-deliver", value: "cash-on-deliver" },
        { label: "other-pay", value: "other-pay" },
        { label: "tosend", value: "tosend" },
        { label: "pending-payment", value: "pending-payment" },
        { label: "paid", value: "paid" },
        { label: "aim", value: "aim" },
        { label: "discount", value: "discount" },
        { label: "idcard", value: "idcard" },
        { label: "replay", value: "replay" },
        { label: "shrink", value: "shrink" }
      ],
      sel_icon: "",
      formLabelWidth: "120px",
      da: this.data,
      show: false,
      isdisabled: true,
      lost: []
    };
  },
  created() {
    if (this.className == "shop") {
      this.da = this.data;
      this.da.filter((item, i) => {
        this.$set(item, "index", i);
      });
    }
  },
  watch: {
    data(val) {
      this.da = val;
      this.da.filter((item, i) => {
        this.$set(item, "index", i);
      });
    }
  },
  methods: {
    open_groupbuy(){
      this.groupbuy_show = true;
    },
    changeSupplierSore(e, id, sort) {
      var params = {};
      params.id = id;
      params.sort = sort;
      this.$api.getSupplier.changeSippluerSort(params).then(res => {
        if (res.data.code != 200) {
          this.$message.error(res.data.result);
        } else if (res.data.code == 200) {
          this.da.sort(this.compare1("shop_sort"));
        }
      });
    },
    compare1(prop) {
      return function(obj1, obj2) {
        var val1 = obj1[prop];
        var val2 = obj2[prop];
        if (!isNaN(Number(val1)) && !isNaN(Number(val2))) {
          val1 = Number(val1);
          val2 = Number(val2);
        }
        if (val1 > val2) {
          return -1;
        } else if (val1 < val2) {
          return 1;
        } else {
          return 0;
        }
      };
    },
    compare(prop) {
      return function(obj1, obj2) {
        var val1 = obj1[prop];
        var val2 = obj2[prop];
        if (!isNaN(Number(val1)) && !isNaN(Number(val2))) {
          val1 = Number(val1);
          val2 = Number(val2);
        }
        if (val1 < val2) {
          return -1;
        } else if (val1 > val2) {
          return 1;
        } else {
          return 0;
        }
      };
    },
    toChatStr(str) {
      if (str) {
        return str.split(",");
      }
    },
    hover_img(index) {
      this.activeIndex = index;
    },

    add_mer_data() {
      this.shop_show = true;
    },

    getSend_id(val) {
      this.shop_show = false;
      this.$emit("send_add_merchant_id", val.id);
    },
    befau() {},
    upload_pic(pic) {
      let i = this.sel_index;
      console.log(this.da);
      this.da[i].piclink = pic;
    },
    uploadSuccess(response, file, fileList, index) {
      if (response.code == 200 && response.code_desc == "请求成功") {
        this.da[index].piclink = response.result;
      } else if (response.code == 400) {
        this.$message.error("上传失败！不支持的类型");
      }
    },
    del_mer_Data(index, id) {
      this.da.splice(index, 1);
      this.$emit("send_del_merchant_id", { id: id });
    },
    delData(index, id) {
      console.log(this.className);
      this.$emit("sendDel", { title: this.className, id: this.da[index].id });

      this.$emit("send_baner_id", { id: id });
      this.da.splice(index, 1);
    },
    showDio() {
      if (
        this.$store.state.shopSlist == "" ||
        this.$store.state.shopSlist.page != 1
      ) {
        console.log(1);
        this.$store.dispatch("getShopsAll", { page: 1, page_size: 10 });
      }
      this.show = false;
      this.show = !this.show;
    },
    getShow(bool) {
      this.shop_show = bool;
      this.show = bool;
    },
    getSendRow(row) {
      this.$store.dispatch("getShopsAll", { page: 1, page_size: 10 });
      if (row == null) return false;

      let index = row.index;
      this.da[index].disable = row.disable;
      this.da.splice();
      if (!row.disable && row.title == "自定义链接") {
        this.da[index].title = "";
        this.da[index].desc = "";
        this.da[index].disable = row.disable;
        this.da.splice();
        return false;
      }

      if (row.url) {
        this.da[index].links = row.url;
        this.da[index].desc = row.url_title;
        this.da[index].disable = row.disable;
        this.da.splice();
        return;
      }

      if (row.url_title == "产品分类" && row.click_title == "供应商分类") {
        this.da[index].links = "/pages/shop/supplier/supplier?cate=" + row.id;
        this.da[index].desc = row.title + "分类供应商店铺";
        return;
      }
      if (row.url_title == "产品分类" && row.click_title != "供应商分类") {
        this.da[index].links = "/shop/shopsearch?cate_id=" + row.id;
        this.da[index].desc = row.title || "";
      }
      if (row.url_title == "旅游产品分类") {
        this.da[index].links = "/tourshop/cate?cate_id=" + row.id;
        this.da[index].desc = row.title || "";
      }
      if (row.url_title == "插件管理") {
        this.da[index].links = row.url || "";
        this.da[index].desc = row.title || "";
      }

      if (row.url_title == "商品选择") {
        this.da[index].links = "/pages/shop/shopdetail/shopdetail?id=" + row.id;
        this.da[index].desc = row.title || "";
      }
      if (row.url_title == "文章添加") {
        this.da[index].links = "/pages/news/newsdetail/newsdetail?id=" + row.id;
        this.da[index].desc = "文章：" + row.title || "";
      }
      if (row.url_title == "资讯分类") {
        this.da[index].links = "/news?cate_id=" + row.id;
        this.da[index].desc = row.title;
      }
      if (row.url_title == "商品分类2") {
        this.da[index].links = "/shop/shopslide?cate_id=" + row.id;
        this.da[index].desc = row.title || "";
      }
      if (row.url_title == "房产分类") {
        this.da[index].links = "/estate/list?cate_id=" + row.id;
        this.da[index].desc = row.title;
      }
      if (row.url_title == "表单") {
        this.da[index].links = "/pages/sub/form/form?id=" + row.id;
        this.da[index].desc = row.title;
      }
      if (row.url_title == "课程分类") {
        this.da[index].links = "/pages/lesson/lessoncate/lessoncate?id=" + row.id;
        this.da[index].desc = row.title;
      }
    },
    getSend(row) {
      if (row.piclink == "") {
        row.piclink = require("../../assets/img/productDefault.jpg");
      }

      this.$emit("setId", row.id, this.className);

      this.da.unshift(row);
    },

    toChatStr(str) {
      if (str) {
        return str.split(",");
      }
    },
    getInput(e, index) {
      this.da.filter((item, i) => {
        if (i == index) {
          item.index = e;
        }
      });
    },
    open_news() {
      this.$store.dispatch("getNewsList", {});
      this.news_show = true;
    },
    open_lesson() {
      this.lesson_show = true;
    },
    open_estate() {
      this.estate_show = true;
    },
    upGo(fieldData, index) {
      if (index != 0) {
        fieldData[index] = fieldData.splice(index - 1, 1, fieldData[index])[0];
      } else {
        fieldData.push(fieldData.shift());
      }
    },
    downGo(fieldData, index) {
      if (index != fieldData.length - 1) {
        fieldData[index] = fieldData.splice(index + 1, 1, fieldData[index])[0];
      } else {
        fieldData.unshift(fieldData.splice(index, 1)[0]);
      }
    },
    pre_img_btn(fx, item, index) {
      var arr = this.data;
      if (fx == "left") {
        this.upGo(this.data, index);
      } else {
        this.downGo(this.data, index);
      }
    },
    getBlur(e, index) {
      this.da.sort(this.compare("index"));

      // this.$emit('soreProduct')

      var sort_str = "";
      this.da.forEach(el => {
        sort_str = sort_str + el.id + "@";
      });
    }
  },
  components: {
    myUpload,
    LinkMenu,
    xzShop,
    xzusershop,
    xzlesson,
    uploadpic,
    xzNews,
    xzEstate,
    xzgroupbuy
  },
  computed: {},
  mounted() {}
};
</script>
<style scoped lang='less'>
.estate-news-box {
  padding-top: 8px;
  .estate-news-item {
    height: auto;
    .lesson_article_img {
      width: 105px;
      height: 80px;
      border-radius: 5px;
      margin-right: 30px;
      img {
        height: auto;
      }
    }
    .lesson_article_content {
      min-height: 80px;
      width: auto;
      flex: 3;
      > p:first-child {
        font-size: 16px;
        line-height: 1.4;
      }
      > p:last-child {
        font-size: 13px;
        color: #90939a;
        font-weight: normal;
      }
    }
  }
}
.img_nav {
  position: relative;
}
.sel_img_btn {
  /* position: absolute; */
  width: 98px;
  height: 20px;
  background-color: rgba(0, 0, 0, 0.3);
  z-index: 99;
  bottom: 20px;
  left: 0;
  right: 0;
  margin: auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  /* visibility: hidden; */
}
.shops_list:hover .sel_img_btn {
  visibility: visible;
}
.sel_img_left {
  width: 50%;
  display: flex;
  justify-content: flex-start;
  align-items: center;
}
.sel_img_right {
  width: 50%;
  display: flex;
  justify-content: flex-end;
  align-items: center;
}
.sel_img_btn i {
  font-size: 22px;
  color: #ffffff;
}
.sel_img_left:hover .sel_img_right:hover {
  cursor: pointer;
}

.lesson_article_item {
  width: 100%;
  height: 90px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  padding: 10px 20px;
  background: #f0f0f0;
}
.lesson_article_img {
  width: 28%;
}
.lesson_article_img img {
  width: 100%;
  height: 80px;
  border-radius: 5px;
}

.lesson_article_content {
  width: 58%;
  height: 100%;
  display: flex;
  flex-flow: column;
  justify-content: space-between;
  align-items: flex-start;
}
.lesson_article_content p:nth-of-type(1) {
  font-size: 13px;
  color: #000000;
  line-height: 20px;
  text-align: justify;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}
.lesson_article_content p:nth-of-type(2) {
  font-size: 14px;
  font-weight: bold;
  color: #ea6c2b;
  line-height: 20px;
  text-align: left;
}
.lesson_article_content p:nth-of-type(2) span {
  font-size: 12px;
  color: #626262;
  font-weight: normal;
  padding-left: 10px;
}
.lesson_article_sort {
  width: 4%;
  display: flex;
  flex-flow: column;
  justify-content: center;
  align-items: center;
  font-size: 24px;
}
.lesson_article_sort i {
  cursor: pointer;
  padding: 10px 0;
}
.lesson_article_sort i:hover {
  font-size: 28px;
}

.home_item {
  // width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  border-bottom: 1px solid #f2f3f4;
  padding-bottom: 15px;
}
.home_item_left {
  width: 104px;
  height: 94px;
  margin-right: 8px;
}
.home_item_left img {
  width: 100%;
  overflow: hidden;
}
.home_item_right {
  flex: 3;
  min-height: 94px;
  font-size: 12px;
  text-align: left;
}
.home_item_right p:nth-of-type(1) {
  font-size: 16px;
  line-height: 18px;
  padding-bottom: 8px;
  color: #0a0e12;
  font-weight: bold;
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.home_item_right p:nth-of-type(2) {
  width: 100%;
  font-size: 12px;
  color: #000000;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.home_item_right p:nth-of-type(3) {
  width: 100%;
  font-size: 12px;
  color: #333;
  font-weight: bold;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.home_item_right p:nth-of-type(3) span {
  font-size: 18px;
  color: #ff442f;
  font-weight: bold;
  padding-right: 5px;
}
.home_item_right p:nth-of-type(4) {
  color: #333;
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  align-items: center;
}
.home_item_right p:nth-of-type(4) span {
  font-size: 10px;
  line-height: 10px;
  color: #808184;
  border: 1px solid #d7d7d7;
  padding: 5px 5px;
  margin-right: 5px;
  margin-bottom: 5px;
}
.estate-item {
  height: auto;
}
</style>
